package cn.edu.nju.software.cdiy.bean;

import java.io.Serializable;
import java.util.Date;

public class CPU extends Hardware implements Comparable<CPU>, Serializable {

	private static final long serialVersionUID = 3771159151353337268L;
	private int id;
	// 型号1
	private String model;// CPU型号

	// 外键品牌表1
	private BRD_CPU brand;// CPU品牌

	// 外键码表11
	private Value CPUXL;// CPU系列
	private Value coreType;// CPU核心类型
	private Value manuTech;// CPU生产工艺
	private Value wordSize;// 位数
	private Value coreNum;// 核心数量
	private Value threadNum;// 线程数
	private Value L1;// 1级缓存
	private Value L2;// 2级缓存
	private Value L3;// 3级缓存
	private Value displayCoreType;// 显示核心

	// 外键接口表
	private Interface slotType;// 插槽类型

	// 次要指标13
	private double masterFrequency;// 主频
	private double maxMFrequency;// 最大睿频
	private double frequencyMulti;// 倍频
	private String coreVolt;// 核心电压
	private int TURBOBOOST;// Turboboost技术
	private int HT;// HT超线程技术
	private int displayCoreFrequency;// 显示核心频率
	private int TDP;// TDP技术
	private int VIRTUALIZATION;// 虚拟化技术

	private String CSPhone;// 客服电话
	private String qualityPolicy;// 质保政策
	private String qualityTime;// 质保时间
	private String qualityContent;// 质保具体内容

	// 管理类参数6
	private int iPrice;// 入库价格
	private int oPrice;// 出库价格
	private double performance;// 性能
	private Date inStorageTime;// 入库时间
	private String imgPath;// 图片路径
	private Value state;// 状态 //外键；{0:审核中 1:已通过}
	private double wScore;// 网友评分
	private double zScore;// 专家评分
	private int supplier;// 供货商

	private int sale;// 销售量
	private int ratedPower;// 预留信息
	private String rsv3;// 预留信息

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getModel() {
		return model;
	}

	public void setModel(String model) {
		this.model = model;
	}

	public BRD_CPU getBrand() {
		return brand;
	}

	public void setBrand(BRD_CPU brand) {
		this.brand = brand;
	}

	public Value getCPUXL() {
		return CPUXL;
	}

	public void setCPUXL(Value cPUXL) {
		CPUXL = cPUXL;
	}

	public Value getCoreType() {
		return coreType;
	}

	public void setCoreType(Value coreType) {
		this.coreType = coreType;
	}

	public Value getManuTech() {
		return manuTech;
	}

	public void setManuTech(Value manuTech) {
		this.manuTech = manuTech;
	}

	public Value getWordSize() {
		return wordSize;
	}

	public void setWordSize(Value wordSize) {
		this.wordSize = wordSize;
	}

	public Value getCoreNum() {
		return coreNum;
	}

	public void setCoreNum(Value coreNum) {
		this.coreNum = coreNum;
	}

	public Value getThreadNum() {
		return threadNum;
	}

	public void setThreadNum(Value threadNum) {
		this.threadNum = threadNum;
	}

	public Value getL1() {
		return L1;
	}

	public void setL1(Value l1) {
		L1 = l1;
	}

	public Value getL2() {
		return L2;
	}

	public void setL2(Value l2) {
		L2 = l2;
	}

	public Value getL3() {
		return L3;
	}

	public void setL3(Value l3) {
		L3 = l3;
	}

	public Value getDisplayCoreType() {
		return displayCoreType;
	}

	public void setDisplayCoreType(Value displayCoreType) {
		this.displayCoreType = displayCoreType;
	}

	public Interface getSlotType() {
		return slotType;
	}

	public void setSlotType(Interface slotType) {
		this.slotType = slotType;
	}

	public double getMasterFrequency() {
		return masterFrequency;
	}

	public void setMasterFrequency(double masterFrequency) {
		this.masterFrequency = masterFrequency;
	}

	public double getMaxMFrequency() {
		return maxMFrequency;
	}

	public void setMaxMFrequency(double maxMFrequency) {
		this.maxMFrequency = maxMFrequency;
	}

	public double getFrequencyMulti() {
		return frequencyMulti;
	}

	public void setFrequencyMulti(double frequencyMulti) {
		this.frequencyMulti = frequencyMulti;
	}

	public String getCoreVolt() {
		return coreVolt;
	}

	public void setCoreVolt(String coreVolt) {
		this.coreVolt = coreVolt;
	}

	public int getTURBOBOOST() {
		return TURBOBOOST;
	}

	public void setTURBOBOOST(int tURBOBOOST) {
		TURBOBOOST = tURBOBOOST;
	}

	public int getHT() {
		return HT;
	}

	public void setHT(int hT) {
		HT = hT;
	}

	public int getDisplayCoreFrequency() {
		return displayCoreFrequency;
	}

	public void setDisplayCoreFrequency(int displayCoreFrequency) {
		this.displayCoreFrequency = displayCoreFrequency;
	}

	public int getTDP() {
		return TDP;
	}

	public void setTDP(int tDP) {
		TDP = tDP;
	}

	public int getVIRTUALIZATION() {
		return VIRTUALIZATION;
	}

	public void setVIRTUALIZATION(int vIRTUALIZATION) {
		VIRTUALIZATION = vIRTUALIZATION;
	}

	public String getCSPhone() {
		return CSPhone;
	}

	public void setCSPhone(String cSPhone) {
		CSPhone = cSPhone;
	}

	public String getQualityPolicy() {
		return qualityPolicy;
	}

	public void setQualityPolicy(String qualityPolicy) {
		this.qualityPolicy = qualityPolicy;
	}

	public String getQualityTime() {
		return qualityTime;
	}

	public void setQualityTime(String qualityTime) {
		this.qualityTime = qualityTime;
	}

	public String getQualityContent() {
		return qualityContent;
	}

	public void setQualityContent(String qualityContent) {
		this.qualityContent = qualityContent;
	}

	public int getiPrice() {
		return iPrice;
	}

	public void setiPrice(int iPrice) {
		this.iPrice = iPrice;
	}

	public int getoPrice() {
		return oPrice;
	}

	public void setoPrice(int oPrice) {
		this.oPrice = oPrice;
	}

	public double getPerformance() {
		return performance;
	}

	public void setPerformance(double performance) {
		this.performance = performance;
	}

	public Date getInStorageTime() {
		return inStorageTime;
	}

	public void setInStorageTime(Date inStorageTime) {
		this.inStorageTime = inStorageTime;
	}

	public String getImgPath() {
		return imgPath;
	}

	public void setImgPath(String imgPath) {
		this.imgPath = imgPath;
	}

	public Value getState() {
		return state;
	}

	public void setState(Value state) {
		this.state = state;
	}

	public double getwScore() {
		return wScore;
	}

	public void setwScore(double wScore) {
		this.wScore = wScore;
	}

	public double getzScore() {
		return zScore;
	}

	public void setzScore(double zScore) {
		this.zScore = zScore;
	}

	public int getSupplier() {
		return supplier;
	}

	public void setSupplier(int supplier) {
		this.supplier = supplier;
	}

	public int getSale() {
		return sale;
	}

	public void setSale(int sale) {
		this.sale = sale;
	}

	public int getRatedPower() {
		return ratedPower;
	}

	public void setRatedPower(int ratedPower) {
		this.ratedPower = ratedPower;
	}

	public String getRsv3() {
		return rsv3;
	}

	public void setRsv3(String rsv3) {
		this.rsv3 = rsv3;
	}

	@Override
	public int compareTo(CPU o) {

		Date now = new Date();

		// this的热度
		long gap = now.getTime() - inStorageTime.getTime();
		int gapDay = (int) (gap / (24 * 3600 * 1000)) + 1;

		double nowHot = sale / gapDay;

		// 参数的hot
		long oGap = now.getTime() - o.getInStorageTime().getTime();
		int oGapDay = (int) (oGap / (24 * 3600 * 1000));

		double oHot = o.getSale() / oGapDay;

		// 降序排列
		if (nowHot > oHot)
			return -1;
		else if (nowHot == oHot)
			return 0;
		else
			return 1;
	}

}
